package com.aki.ai_property.controller;

import com.aki.ai_property.entity.Contract;
import com.aki.ai_property.entity.Repairs;
import com.aki.ai_property.service.intf.RepairsService;
import com.aki.ai_property.vo.PageBean;
import com.aki.ai_property.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 孙贺鹏
 * @date 2022/8/28
 */
@RestController
@RequestMapping("/api/repairs/")
public class RepairsController {
    @Autowired
    private RepairsService service;
    /** 新增 */
    @PostMapping("save.do")
    public Result save(Repairs repairs){
        return service.save(repairs);
    }

    /** 修改 */
    @PostMapping("update.do")
    public Result update(Repairs repairs){
        return service.update(repairs);
    }

    /** 删除 */
    @GetMapping("delete.do")
    public Result delete(int id){
        return service.delete(id);
    }

    /** 查询 */
    @GetMapping("all.do")
    public PageBean page(String repairsContent,int page,int limit){
        return service.selectPage(repairsContent,page,limit);
    }
    /**批量删除*/
    @PostMapping("delids.do")
    public Result dels(int[] ids){
        return service.delIds(ids);
    }

    /**统计各个维修状态的数量*/
    @GetMapping("selectRep.do")
    public Result sexTj(){
        return service.selectRep();
    }
}
